package main

import (
	beego "github.com/beego/beego/v2/server/web"
	"github.com/beego/beego/v2/server/web/filter/cors"
	"sanya-trip/appconfig"
	"sanya-trip/cache"
	"sanya-trip/models"
	_ "sanya-trip/routers"
)

func main() {
	beego.InsertFilter("*", beego.BeforeRouter, cors.Allow(&cors.Options{
		AllowAllOrigins: true,
		AllowOrigins:    []string{"*"},
		AllowMethods:    []string{"*"},
		AllowHeaders:    []string{"*"},
		ExposeHeaders:   []string{"*"},
	}))

	appconfig.Init()
	cache.Init()
	models.Init()
	beego.Run()
}
